package com.cloud.shopping.goods.mapper;

import com.cloud.shopping.goods.model.SkuAttribute;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author John.zhang
 * @since 2020-12-28
 */
public interface SkuAttributeMapper extends BaseMapper<SkuAttribute> {

    /**
     * 1、根据分类ID查询属性ID集合
     * 2、根据属性ID集合查询属性集合
     * @param id id
     * @return List
     */
    @Select("select * from sku_attribute where id IN(SELECT attr_id FROM category_attr WHERE category_id=#{id})")
    List<SkuAttribute> queryByCategoryId(Integer id);

}
